home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir37 / mxmnu241.zip / GRID.INC < prev    next >
Text File  |  1992-06-02  |  7KB  |  270 lines

  1. Comment
  2. ==========================================================
  3.  
  4. This include file exports definitions that create a block menu look and
  5. feel. This is one of several look and feel files that export the same
  6. procedures.
  7.  
  8. Useful Routines Exported:
  9.  
  10. LookSetup
  11.    Call this to initialize the screen. Set MenuTitle and StatusLineText
  12.    before calling this routine.
  13.  
  14. CornerStretchBox (Header,Col,Row)
  15.    Creates a window from the array Choices with the upper left corner at
  16.    Row/Col. LastKey is set to the letter that is chosen.
  17.  
  18. CenterStretchBox (Header,Col,Row)
  19.    Creates a window from the array Choices with the center at Row/Col.
  20.    if a 0 is passed for either the Row or Col then the center of the
  21.    screen is assumed. LastKey is set to the letter that is chosen.
  22.  
  23. Leave
  24.    Puts up an exit box.
  25.  
  26.  
  27. ==========================================================
  28. EndComment
  29.  
  30.  
  31. var
  32.   Grid1 = "╠═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╣"
  33.   Grid2 = "├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤"
  34.   Grid3 = "╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣"
  35.   Grid4 = "├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤"
  36.   Choices
  37.   MenuTitle
  38.   StatusLineText
  39.   StatusWindow
  40.   HeightDifference
  41.   Greek = False
  42.  
  43. var
  44.   BackGroundFG
  45.   BackGroundBG
  46.   TitleBoxBorderFG
  47.   TitleBoxBG
  48.   TitleBoxInsideFG
  49.   ClockColorFG
  50.   StatusLineFG
  51.   StatusLineBG
  52.   MenuInsideFG
  53.   MenuBG
  54.   MenuHeaderFG
  55.   MenuHeaderBG
  56.   MenuBorderFG
  57.   MenuVertLinesFG
  58.   MenuInverseFG
  59.   MenuInverseBG
  60.   MenuCapColorFG
  61.   ConsoleInsideFG
  62.   GreekFG
  63.   GreekBG
  64.  
  65. ;------ This is where you set your favorite colors.
  66.  
  67. Procedure SetColors
  68.    if ColorScreen
  69.       BackGroundFG     = LBlue
  70.       BackGroundBG     = Black
  71.       TitleBoxBG       = Brown
  72.       TitleBoxBorderFG = White
  73.       TitleBoxInsideFG = Yellow
  74.       ClockColorFG     = Yellow
  75.       StatusLineFG     = Yellow
  76.       StatusLineBG     = Mag
  77.       MenuBG           = Black
  78.       MenuInsideFG     = Yellow
  79.       MenuBorderFG     = LRed
  80.       MenuHeaderFG     = White
  81.       MenuHeaderBG     = Green
  82.       MenuVertLinesFG  = LGreen
  83.       MenuInverseFG    = Yellow
  84.       MenuInverseBG    = Mag
  85.       MenuCapColorFG   = White
  86.       ConsoleInsideFG  = White
  87.       GreekFG          = Black
  88.       GreekBG          = Brown
  89.    else
  90.       BackGroundFG     = Grey
  91.       BackGroundBG     = Black
  92.       TitleBoxBG       = Grey
  93.       TitleBoxBorderFG = Black
  94.       TitleBoxInsideFG = Black
  95.       ClockColorFG     = Black
  96.       StatusLineFG     = Black
  97.       StatusLineBG     = Grey
  98.       MenuBG           = Black
  99.       MenuInsideFG     = Grey
  100.       MenuBorderFG     = White
  101.       MenuHeaderFG     = Black
  102.       MenuHeaderBG     = Grey
  103.       MenuVertLinesFG  = White
  104.       MenuInverseFG    = Black
  105.       MenuInverseBG    = Grey
  106.       MenuCapColorFG   = White
  107.       ConsoleInsideFG  = Grey
  108.       GreekFG          = Black
  109.       GreekBG          = Grey
  110.    endif
  111. EndProc
  112.  
  113. ;------ Sets up main window to block look.
  114.  
  115. Procedure LookSetup
  116.    if MenuInsideFG = 0 then SetColors
  117.    NoExit
  118.  
  119.    ;------ Clear the screen with a textured background
  120.  
  121.    TextColor BackGroundFG BackGroundBG
  122.    ClearScreen
  123.    GotoXY 1 3
  124.    loop ScreenHeight - 3
  125.       Writeln Grid3
  126.    endloop
  127.  
  128.    ;------ If Greek is true then draw greek columns
  129.  
  130. ;   if Greek then GreekColumns
  131.  
  132.    ;------ Draw Status Line
  133.  
  134.    NoBoxBorder
  135.    Explode Off
  136.    BoxInsideColor StatusLineFG StatusLineBG
  137.    DrawBox 1 ScreenHeight ScreenWidth 1
  138.    StatusWindow = CurrentWindow
  139.    WriteCenter(StatusLineText)
  140.  
  141.    ;------ Draw the Title Box
  142.  
  143.    SingleLineBox
  144.    Explode Off
  145.    BoxInsideColor TitleBoxInsideFG TitleBoxBG
  146.    BoxBorderColor TitleBoxBorderFG TitleBoxBG
  147.    DrawBox 1 1 ScreenWidth 3
  148.    GotoXY(ScreenWidth - Length(MenuTitle) - 3,1)
  149.    Write MenuTitle
  150.  
  151.    ;------ Display the clock
  152.  
  153.    ClockColor ClockColorFG TitleBoxBG
  154.    ClockPos 3 2
  155.  
  156.    ;------ Setup Console
  157.  
  158.    ConsolePos 42 5
  159.    ConsoleHeaderColor MenuInverseFG MenuInverseBG
  160.    ConsoleInsideColor ConsoleInsideFG MenuBG
  161.  
  162.    BoxHeaderColor MenuHeaderFG MenuHeaderBG
  163.    HeightDifference = 2
  164.    SmallShadow
  165.    Shadow
  166. EndProc
  167.  
  168.  
  169. Procedure MakeBox(Header,Col,Row,Center)
  170. var NumElem Height Width Cnt
  171.  
  172.    Width = Length(Header) + 1
  173.    NumElem = NumberOfElements(Choices)
  174.  
  175.      ;Get the widest element in the Choices Array
  176.  
  177.    if Length(Choices[1]) > 0
  178.       Cnt = 65
  179.       loop NumElem
  180.          Trim(Choices[LoopIndex])
  181.          if left(Choices[LoopIndex],1) <> '─'
  182.             Choices[LoopIndex] = " " + Char(Cnt) + ". " + Choices[LoopIndex]
  183.             Cnt = Cnt + 1
  184.          endif
  185.          Width = Max(Width,Length(Choices[LoopIndex]))
  186.       endloop
  187.    else
  188.       Width = ScreenWidth - 9
  189.    endif
  190.    Height = NumElem + 2
  191.    Width = Width + 5
  192.    if Center
  193.       if Row = 0
  194.  
  195.          ;Center window verticaly
  196.  
  197.          Row = ((ScreenHeight - Height) / 2) + 2
  198.       else
  199.  
  200.          ;Center window with X Coordinate
  201.  
  202.          Row = (Row - (Height / 2) + 1)
  203.       endif
  204.       if Col = 0
  205.  
  206.          ;Center window horizonitly
  207.  
  208.          Col = (ScreenWidth - Width) / 2 + 1
  209.       else
  210.  
  211.          ;Center window with Y Coordinate
  212.  
  213.          Col = (Col - (Width / 2) + 1)
  214.       endif
  215.    endif
  216.  
  217.    ;Make Sure Row and Col are within their range
  218.  
  219.    Row = Max(Row,5)
  220.    Row = Min(Row,ScreenHeight - Height - 2)
  221.    Col = Max(Col,2)
  222.    Col = Min(Col,ScreenWidth - Width - 2)
  223.  
  224.    DrawTheBox(Col,Row,Width,Height,Header)
  225.  
  226.      ;Write the menu choices
  227.  
  228.    loop(NumElem - 1)
  229.       if left(Choices[LoopIndex],1) = '─'
  230.          TextColor MenuVertLinesFG MenuBG
  231.          ClearLine 196
  232.          TextColor MenuInsideFG MenuBG
  233.          CapsColor(MenuCapColorFG,MenuBG)
  234.          Writeln
  235.       else
  236.          Writeln(Choices[LoopIndex])
  237.       endif
  238.    endloop
  239.  
  240.    Write Choices[NumElem]
  241.    UseArrows On
  242.    Dispose(Choices)
  243. EndProc
  244.  
  245. ;------ Draw the Box
  246.  
  247. Procedure DrawTheBox (Col,Row,Width,Height,Header)
  248.  
  249.      ;Draw the main window
  250.  
  251.    DoubleLineBox
  252.    InActiveBox SingleLineBox
  253.    BoxInsideColor(MenuInsideFG,MenuBG)
  254.    BoxBorderColor(MenuBorderFG,MenuBG)
  255.    if Header > '' then Header = ' ' + Header + ' '
  256.    BoxHeader = Header
  257.    DrawBox(Col, Row, Width, Height)
  258.  
  259.    if Header > ''
  260.  
  261.       TextColor MenuInsideFG MenuBG
  262.       CapsColor(MenuCapColorFG,MenuBG)
  263.       InverseColor(MenuInverseFG,MenuInverseBG)
  264.       Window(Col + 2, Row + 1, Width - 4, Height - 2)
  265.    else
  266.       CapsColor Black Black
  267.    endif
  268. EndProc
  269.  
  270.